package com.aigou.service.impl;

import com.aigou.dao.ProductDAO;
import com.aigou.dao.impl.ProductDAOImpl;
import com.aigou.entity.Product;
import com.aigou.service.ProductService;

import java.util.List;

public class ProductServiceImpl implements ProductService {
    //调用dao层对象
    private ProductDAO productDAO = new ProductDAOImpl();

    @Override
    public List<Product> findAll() {
        return productDAO.selectAll();
    }

    @Override
    public Product findById(String id) {
        return productDAO.selectById(id);
    }

    @Override
    public boolean save(Product product) {
        return productDAO.insert(product);
    }

    @Override
    public boolean remove(String id) {
        return productDAO.delete(id);
    }

    @Override
    public boolean update(Product product) {
        return productDAO.update(product);
    }
}
